//
//  XSJEmoticonButton.swift
//  weiBo项目准备
//
//  Created by 鲜世杰 on 16/5/22.
//  Copyright © 2016年 鲜世杰. All rights reserved.
//

import UIKit

class XSJEmoticonButton: UIButton {

    
    var emoticon : XSJEmoticon? {
    
        didSet {
        
            guard let etn = emoticon else {
            
            return
            }
            self.hidden = false
            if etn.type == "0" {
            
                self.setImage(UIImage(named: etn.path!), forState: .Normal)
                self.setTitle(nil, forState: .Normal)

            
            
            }else{
            
            
                self.setImage(nil, forState: .Normal)
                self.setTitle((etn.code! as NSString).emoji(), forState: .Normal)

            
            }
        
        }
    
    
    }
    
    
    
    
}
